package com.cskaoyan.day2.collection._03_example;

import java.util.ArrayList;
import java.util.Collection;

/**
 * @author Common-zhou
 * @since 2023-02-28 16:28
 */
public class Demo2 {
    public static void main(String[] args) {
        Collection<String> collection = new ArrayList<>();

        collection.add("zs");
        collection.add("ls");
        collection.add("zs");
        collection.add("wu");
        collection.add("zs");
        collection.add("zs");
        collection.add("zs");
        collection.add("zs");


        while (true) {
            // 删除成功 返回true
            // 删除失败 返回false
            boolean remove = collection.remove("zs");
            if (!remove) {
                break;
            }
        }

        System.out.println(collection);

    }
}
